import type { AddressItem, AddressParams } from "@/types/address";
import { http } from "@/utils/http";

// 添加收货地址
export const postMemberAddress = (data: AddressParams) => {
  return http({
    method: 'POST',
    url: '/member/address',
    data,
  })
}
// 获取收货地址列表
export const getMemberAddress = () => {
  return http<AddressItem[]>({
    method: 'GET',
    url: '/member/address'
  })
}
// 修改收货地址
export const putMemberAddressById = (id: string, data: AddressParams) => {
  return http({
    method: 'PUT',
    url: `/member/address/${id}`,
    data
  })
}

// 删除收货地址
export const deleteMemberAddressById = (id: string) => {
  return http({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}
